#include <stdio.h>
#include <stdlib.h>
typedef int KeyType;
typedef struct BiNode
{
    KeyType key;
    struct BiNode* Lchild;
    struct BiNode* rchild;
}BiNode,*BiTree;
int Bst_insert(BiTree &T,KeyType k)
{
    if(T==NULL)
    {
        T=(BiTree) calloc(1,sizeof(BiNode));
        T->key=k;
        return 1;
    }
    else if(T->key==k)
    {
        return 0;
    }
    else if(k>T->key)
    {
        return Bst_insert(T->rchild,k);
    }
    else
        return Bst_insert(T->Lchild,k);

}
void Creat_BiTree(BiTree &T,KeyType *str,int n)
{   T=NULL;
    int i=0;
    while(i<n) {
        Bst_insert(T, str[i]);
        i++;
    }
}
void Inorder(BiTree T)
{
    if (NULL!=T)
    {
        Inorder(T->Lchild);
        printf("%3d",T->key);
        Inorder(T->rchild);
    }
}
int main() {
    BiTree T;
    BiTree parent;
    KeyType str[]={23,45,67,12,34,78,56};
    Creat_BiTree(T,str,7);
    Inorder(T);
    return 0;
}
